Ext.require([
    'AM.service.Insert'
])

Ext.define("AM.picker.Shape", {

    extend:'Ext.window.Window',

    listeners: {
        render: function(){
            var me = this;
            var names = ['Happy', 'CloudDialog', 'Line', 'Star', 'Timer', 'Triangle'];
            Ext.each(names, function (name) {
                var item = Ext.create("AM.component.shape." + name, {style:{border:'1px #0687FF solid'}});

                item.on('render', function(){
                    item.el.dom.addEventListener('click', function(){
                        AM.service.Insert.insertShapeByName(name);
                    })
                })
                me.add(item);
            });
        },
        beforeclose: function() {
            this.hide();
            return false;
        }
    },

    title:'选择形状',
    autoShow:true,
    autoScroll:true,
    width:500,
    height:300
})